﻿using ProjectManager.Logic.Content;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProjectManager.Logic
{
    internal static class IDGenerator
    {
        public static int GenerateTeamID(this List<TeamInformation> teams)
        {
            int id_max = 0;
            foreach (TeamInformation team in teams)
            {
                id_max = id_max > team.ID ? id_max : team.ID;
            }
            return id_max + new Random(Thread.GetCurrentProcessorId()).Next(1, 10);
        }
        public static int GenerateMemberID(this List<TeamInformation> teams)
        {
            int id_max = 0;
            foreach (TeamInformation team in teams)
            {
                id_max = id_max > team.Leader.ID ? id_max : team.Leader.ID;
            }
            return id_max + new Random(Thread.GetCurrentProcessorId()).Next(1, 10);
        }
        public static int GenerateTaskID(this List<ProjectTaskInformation> tasks)
        {
            int id_max = 0;
            foreach (ProjectTaskInformation task in tasks)
            {
                id_max = id_max > task.ID ? id_max : task.ID;
            }
            return id_max + new Random(Thread.GetCurrentProcessorId()).Next(1, 10);
        }
    }
}
